From 35f0e05a16a0e7540db32ca4ceea5d80f9e2a82a Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20H=C3=A4rdeman?= Date: Sun, 14 Dec 2025 13:17:06 +0100 Subject: [PATCH] config: add default value for dhcpv6_pd_min_len MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Right now, dhcpv6_pd_min_len is zero, meaning any request would be accepted (as long as it fits what we have available). That means that with a /56 (a common residential scenario), a downstream router can request a /57 and gobble up 1/2 of the available address space. Even a default dhcpv6_pd_min_len value of 60 means that we'd support 15 PDs in total. So let's err on the side of caution and set /62 as the default, people who want larger allocations can easily override the default. Signed-off-by: David Härdeman Link: https://github.com/openwrt/odhcpd/pull/357 Signed-off-by: Álvaro Fernández Rojas --- README.md | 2 +- src/config.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 97717d2..7226e52 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ and may also receive information from ubus | dhcpv6_na |bool | 1 | DHCPv6 stateful addressing hands out IA_NA - Internet Address - Network Address | | dhcpv6_pd |bool | 1 | DHCPv6 stateful addressing hands out IA_PD - Internet Address - Prefix Delegation (PD) | | dhcpv6_pd_preferred |bool | 0 | Set the DHCPv6-PD Preferred (P) flag in outgoing ICMPv6 RA message PIOs (RFC9762); requires `dhcpv6` and `dhcpv6_pd`. | -| dhcpv6_pd_min_len |integer| - | Minimum prefix length to delegate with IA_PD (value is adjusted if needed to be greater than the interface prefix length). Range [1,64] | +| dhcpv6_pd_min_len |integer| 62 | Minimum prefix length to delegate with IA_PD (adjusted, if necessary, to be longer than the interface prefix length). Range [1,64] | | router |list |``| IPv4 addresses of routers on a given subnet (provided via DHCPv4, should be in order of preference) | | dns |list |``| DNS servers to announce, accepts IPv4 and IPv6 | | dnr |list |disabled| Encrypted DNS servers to announce, ` [ ...]` | diff --git a/src/config.c b/src/config.c index 6948b0f..ca0b868 100644 --- a/src/config.c +++ b/src/config.c @@ -69,7 +69,8 @@ struct sys_conf sys_conf = { #define HOSTID_LEN_MAX 64 #define HOSTID_LEN_DEFAULT HOSTID_LEN_MIN -#define PD_MIN_LEN_MAX 64 +#define PD_MIN_LEN_MAX 64 +#define PD_MIN_LEN_DEFAULT 62 #define OAF_DHCPV6 (OAF_DHCPV6_NA | OAF_DHCPV6_PD) @@ -324,7 +325,7 @@ static void set_interface_defaults(struct interface *iface) iface->dhcpv6_assignall = true; iface->dhcpv6_pd = true; iface->dhcpv6_pd_preferred = false; - iface->dhcpv6_pd_min_len = 0; + iface->dhcpv6_pd_min_len = PD_MIN_LEN_DEFAULT; iface->dhcpv6_na = true; iface->dhcpv6_hostid_len = HOSTID_LEN_DEFAULT; iface->dns_service = true; -- 2.30.2